package com.wthink.hzgj.gpsInfo

import android.os.Build
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.CompoundButton
import android.widget.SeekBar
import androidx.annotation.RequiresApi
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.navigation.findNavController
import com.wthink.hzgj.R
import com.wthink.hzgj.databinding.FragmentGpsinfoBinding
import com.wthink.hzgj.gpsInfo.viewModel.GpsInfoViewModel


class GpsInfoFragment : Fragment(){

    private val viewModel by viewModels<GpsInfoViewModel>()

    private lateinit var binding: FragmentGpsinfoBinding

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        binding = DataBindingUtil.inflate(
            inflater,
            R.layout.fragment_gpsinfo,
            container,
            false
        )
        binding.viewModel = viewModel
        binding.lifecycleOwner = this

        return binding.root
    }

    @RequiresApi(Build.VERSION_CODES.O)
    override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)

        binding.back.setOnClickListener {
            it.findNavController().popBackStack()
        }

        viewModel.getGpsInfos()

    }
}
